/*-----------------------------------------------------------------------------
 * @file   hal_irq.c
 * @brief  Implement interface of IRQ Module
 * @author WLH<wanglehui8357@163.com> Copyright (C) 2021~2099.
-----------------------------------------------------------------------------*/
#include "hal_irq.h"
#include "board.h"

/*-----------------------------------------------------------------------------
 * marcro define
-----------------------------------------------------------------------------*/

/*-----------------------------------------------------------------------------
 * local variable
-----------------------------------------------------------------------------*/

/*-----------------------------------------------------------------------------
 * local functions
-----------------------------------------------------------------------------*/

/*-----------------------------------------------------------------------------
 * public functions
-----------------------------------------------------------------------------*/
void hal_irq_enter_critical(vU32 *atomic)
{
    *atomic = __get_PRIMASK();
    __disable_irq();
    __DMB();
}

void hal_irq_exit_critical(vU32 *atomic)
{
    __DMB();
    __set_PRIMASK(*atomic);
}
